/**
 * Company : Thai Informatic System Co., Ltd.
 * Created By : Dr.Tree
 * Created On : May 24, 2012  2:20:10 PM 
 * e-Mail : chatree@tis.co.th
 * Mobile Phone : (+66) 087-921-5115
 * Package Name : sap.business.commons.services
 * File Name : CommonJCOReturn.java
 * TODO
 */
package sap.business.commons.services;

import org.apache.log4j.Logger;
import promis.utility.CommonService;
import com.sap.mw.jco.JCO;

/**
 * @author chatree
 *
 */
public class CommonJCOReturn { 
	
	private static final Logger log = Logger.getLogger(CommonJCOReturn.class);
	
	public static String toString(JCO.Table jcoTable_return) throws Exception {
		try{
			if(!jcoTable_return.isEmpty()){
				
				String PROMIS_TXN_ID = (CommonService.IsNullRNull(jcoTable_return.getString("PROMIS_TXN_ID")) == null ? " No Message." : CommonService.IsNullRNull(jcoTable_return.getString("PROMIS_TXN_ID")));
				String MSG_CODE = (CommonService.IsNullRNull(jcoTable_return.getString("MSG_CODE")) == null ? " No Message." : CommonService.IsNullRNull(jcoTable_return.getString("MSG_CODE")));
				String MSG_DESC = (CommonService.IsNullRNull(jcoTable_return.getString("MSG_DESC")) == null ? " No Message." : CommonService.IsNullRNull(jcoTable_return.getString("MSG_DESC")));
				String MSG_ALT_DESC = (CommonService.IsNullRNull(jcoTable_return.getString("MSG_ALT_DESC")) == null ? " No Message." : CommonService.IsNullRNull(jcoTable_return.getString("MSG_ALT_DESC")));
				String MSG_ACTION_RESULT = (CommonService.IsNullRNull(jcoTable_return.getString("MSG_ACTION_RESULT")) == null ? " No Message." : CommonService.IsNullRNull(jcoTable_return.getString("MSG_ACTION_RESULT")));
				
				System.out.println("PROMIS_TXN_ID=" + PROMIS_TXN_ID + " //MSG_CODE=" + MSG_CODE + " //MSG_DESC=" + MSG_DESC + "// MSG_ALT_DESC=" + MSG_ALT_DESC+ "//MSG_ACTION_RESULT=" + MSG_ACTION_RESULT);				
				return ("PROMIS_TXN_ID=" + PROMIS_TXN_ID + " //MSG_CODE=" + MSG_CODE + " //MSG_DESC=" + MSG_DESC + "// MSG_ALT_DESC=" + MSG_ALT_DESC+ "//MSG_ACTION_RESULT=" + MSG_ACTION_RESULT);
			
			}else{
				System.out.println("Update Message Retrun table getNumRows = " + jcoTable_return.getNumRows() +" Row, is Empty.");
				return "Update Message Retrun table getNumRows = " + jcoTable_return.getNumRows() +" Row, is Empty.";
			}
				
			
		}catch(Exception e)
		{
			log.error(e.getMessage());
			System.err.println(e.getMessage());
			throw e;
		}
	}
	
	/*
	public static String toString(JCO.Table table) throws Exception {
		try{
			if(!table.isEmpty()){
				
				String PROMIS_TXN_ID = (CommonService.IsNullRNull(table.getString("PROMIS_TXN_ID")) == null ? " No Message." : CommonService.IsNullRNull(table.getString("PROMIS_TXN_ID")));
				String MSG_CODE = (CommonService.IsNullRNull(table.getString("MSG_CODE")) == null ? " No Message." : CommonService.IsNullRNull(table.getString("MSG_CODE")));
				String MSG_DESC = (CommonService.IsNullRNull(table.getString("MSG_DESC")) == null ? " No Message." : CommonService.IsNullRNull(table.getString("MSG_DESC")));
				String MSG_ALT_DESC = (CommonService.IsNullRNull(table.getString("MSG_ALT_DESC")) == null ? " No Message." : CommonService.IsNullRNull(table.getString("MSG_ALT_DESC")));
				String MSG_ACTION_RESULT = (CommonService.IsNullRNull(table.getString("MSG_ACTION_RESULT")) == null ? " No Message." : CommonService.IsNullRNull(table.getString("MSG_ACTION_RESULT")));
			
				System.out.println("PROMIS_TXN_ID=" + PROMIS_TXN_ID + " //MSG_CODE=" + MSG_CODE + " //MSG_DESC=" + MSG_DESC + "// MSG_ALT_DESC=" + MSG_ALT_DESC+ "//MSG_ACTION_RESULT=" + MSG_ACTION_RESULT);
				return ("PROMIS_TXN_ID=" + PROMIS_TXN_ID + " //MSG_CODE=" + MSG_CODE + " //MSG_DESC=" + MSG_DESC + "// MSG_ALT_DESC=" + MSG_ALT_DESC+ "//MSG_ACTION_RESULT=" + MSG_ACTION_RESULT);
			
			}else{
				System.out.println("Update Message Retrun table getNumRows = " + table.getNumRows() +" Row, is Empty.");
				return "Update Message Retrun table getNumRows = " + table.getNumRows() +" Row, is Empty.";
			}				
			
		}catch(Exception e)
		{
			log.error(e.getMessage());
			System.err.println(e.getMessage());
			throw e;
		}
	}
	*/
	
}
